< previous page page_617 next page >

Page 617
If you multiply this out and group the t and u terms, you get:
e10a6a0a59f035e870d90cca05b85fce.gif
V · R= u * (-Wx2 - Wy2 - Wz2) +
       t * (Wx * Vx + Wy * Vy + Wz * Vz) + 
       Wx * (px - x1) + Wy * (py - y1) + Wz * (pz - z1)
Because the dot product should be equal to zero, you can set this equation equal to zero and solve for the parameter u. With some rearranging and a couple of substitutions, the equation becomes:
e10a6a0a59f035e870d90cca05b85fce.gif
u = A * t + B
where:
e10a6a0a59f035e870d90cca05b85fce.gif
A = (Wx * Vx + Wy * Vy + Wz * Vz) / (Wx2 + Wy2 + Wz2) 
B = (Wx * (px - x1) + Wy * (py - y1) + Wz * (pz  - z1)) / 
    (Wx
2 + Wy2 + Wz2)
This gives you an equation for u in terms of t. The values of A and B are complicated, but they are still only constants. Their values depend on the geometry of the cylinder and the ray.
Because this equation contains two unknown values u and t, it does not hold enough information for you to solve for both values. You need another equation relating u and t. You can get one by noting that the length of vector R must equal the radius of the cylinder. Equivalently, the square of the length of vector R must equal the square of the radius.
e10a6a0a59f035e870d90cca05b85fce.gif
Radius2 = (Hx - Ix)2 + (Hy - Iy) 2 +(Hz - Iz)2
Substituting the parametric values for the points H and I as before gives:
e10a6a0a59f035e870d90cca05b85fce.gif
Radius2  =    ((px + Vx * t) - (x1 + Wx * u))2 +
      ((py + Vy * t) - (y1 + Wy * u))
2 +
      ((pz  + Vz * t) - (z1 + Wz * u))
2
Replacing the parameter u with the equation describing u in terms of t, this becomes:
e10a6a0a59f035e870d90cca05b85fce.gif
Radius2      =        (px + Vx * t - x1 - Wx * (A * t + B))2 
      (py + Vy * t - y1 - Wy * (A * t + B))
2 +
      (pz + Vz * t - z1 - Wz * (A * t + B))
2
=     (t * (Vx - Wx * A) + (px - x1 - Wx * B))2 +
      (t * (Vy - Wy * A) + (py - y1 - Wy * B))
2 + 
      (t * (Vz - Wz * A) + (pz - z1 - Wz * B))
2 +
You can make this equation easier to manage by making the following substitutions.
e10a6a0a59f035e870d90cca05b85fce.gif
Cx = Vx - Wx * A
Cy = Vy - Wy * A
Cz = Vz - Wz * A

 
< previous page page_617 next page >